package com.ap.core.ldap.domain;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


/**
 * LDAP entity for Zapp Consumer
 */
public class LdapZappUser extends BaseLdapUser{

    private final static String DISTINGUISHED_GROUP = "ConsumerUsers";

    private final List<String> OBJECT_CLASS_NAMES = Arrays.asList("person", "organizationalPerson", "inetOrgPerson", "zappPerson");
    private final String DISTINGUISHED_GROUP_NAME = "cn=ConsumerUsers";


    private LdapAttribute<String> userName = new LdapAttribute<>("displayname");
    private LdapAttribute<String> emailId = new LdapAttribute<>("mail");
    private LdapAttribute<String> mobileNumber = new LdapAttribute<>("mobile");
    private LdapAttribute<Object> password = new LdapAttribute<>("userpassword");
    private LdapAttribute<String> userHash = new LdapAttribute<>("userHash");
    private LdapAttribute<String> agreedTermsAndConditions = new LdapAttribute<>("agreedtermsandconditions");

    public LdapAttribute<Object> getPassword() {
        return password;
    }

    public void setPassword(Object password) {
        this.password.setLdapAttributeValue(password);
    }

    public void setUserHash(String userHash) {
        this.userHash.setLdapAttributeValue(userHash);
    }

    public LdapAttribute<String> getUserHash() {
        return userHash;
    }

    public LdapAttribute<String> getEmailId() {
        return emailId;
    }

    public void setEmailId(String emailId) {
        this.emailId.setLdapAttributeValue(emailId);
    }

    public LdapAttribute<String> getAgreedTermsAndConditions() {
        return agreedTermsAndConditions;
    }

    public void setAgreedTermsAndConditions(String agreedtermsandconditions) {
        this.agreedTermsAndConditions.setLdapAttributeValue(agreedtermsandconditions);
    }

    public LdapAttribute<String> getMobileNumber() {
        return mobileNumber;
    }

    public void setMobileNumber(String mobileNumber) {
        this.mobileNumber.setLdapAttributeValue(mobileNumber);
    }

    public LdapAttribute<String> getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName.setLdapAttributeValue(userName);
    }

    public List<LdapAttribute<?>> getLdapAttributes(){
        final List<LdapAttribute<?>> attributes = new ArrayList<>();
        attributes.addAll(super.getLdapAttributes());
        attributes.add(emailId);
        attributes.add(mobileNumber);
        attributes.add(userName);
        attributes.add(password);
        attributes.add(userHash);
        attributes.add(agreedTermsAndConditions);
        return attributes;
    }

    public List<String> getObjectClassNames() {
        return OBJECT_CLASS_NAMES;
    }

    public String getDistinguishedGroupName() {
        return DISTINGUISHED_GROUP_NAME;
    }

    public static String getDistinguishedGroup() {
        return DISTINGUISHED_GROUP;
    }
}
